<?php 
include("../includes/conexion.php");


?>



<html> 
<head> 
<style>
.nro_ingreso{
    border:#999999;
	
}
hr{
   color:#000000
}
table th{
      font:12px Arial, Helvetica, sans-serif;
	  font-weight:bolder;
	  
}
table tr.data{
      font:10px Arial, Helvetica, sans-serif;
}
</style>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50" colspan="2" align="center">UNIVERSIDAD NACIONAL  AGRARIA DE LA SELVA</td>
  </tr>
  <tr>
    <td height="72" colspan="2" align="center">Reporte de Existencia de Documentos</td>
  </tr>
  <tr>
    <td colspan="2">
	
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="10%" align='left'>CODIGO</th>
        <th width="40%" align='left'>TITULO</th>
        <th width="40%" align='left'>AUTOR</th>
        <th width="10%" align='left'>FECHA.PUB.</th>
        <th width="10%" align='left'>NRO.PAG</th>		
      </tr>
      <tr>
        <th width="100%" colspan="5"><hr></th>
      </tr>	  
	  <?php 
	    $sql="
				select d.id_doc,d.codigo_LTP,
				d.titulo_LTRP,d.autor,d.fecha_publicacion,d.numero_paginas
								from documento d	  
								where id_tipo_documento='$_GET[tipo_doc]'		
		";
		$tr="";
	    $qry_detalle=mysql_query($sql);
	  	while($rs=mysql_fetch_array($qry_detalle)){
		    
			$tr .= "
					  <tr class='data'>
						<td width='20%' align='left'>$rs[codigo_LTP]</td>
						<td width='35%' align='left'>".utf8_decode($rs['titulo_LTRP'])."</td>
						<td width='35%' align='left'>".utf8_decode($rs['autor'])."</td>
						<td width='5%' align='left'>$rs[fecha_publicacion]</td>
						<td width='5%' align='left'>$rs[numero_paginas]</td>
					  </tr>			
			";
			
			$sql="
					select * from existencias_documento where id_doc = $rs[id_doc]	  	
			";
			$qry_detalle2=mysql_query($sql);
			
			$tr .= "<tr align='center'><td colspan='4'><table width='20%' border='0' cellspacing='0' cellpadding='0'>";
			$tr .= "
						  <tr>
							<th width='60%'>Numero Ingreso</th>
							<th width='40%'>Tipo</th>
						  </tr>	
						  <tr>
							<td colspan=2><hr></td>
						  </tr>							  		
			";
			while($rs2=mysql_fetch_array($qry_detalle2)){
				
				$tr .= "						 
						  <tr class='data'>
							<td align='center'>$rs2[numero_ingreso]</th>
							<td align='center'>$rs2[tipo]</th>
						  </tr>						     													
				";						
			}			
			
			$tr .= "<tr><td colspan=2 height=25></td> </tr>	</table></td></tr>";			
			
			
			
			
					
		}
		echo $tr;
		
	  ?>
    </table>	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="28%">&nbsp;</th>
        <th width="72%">&nbsp;</th>
        </tr>
      <tr>
        <th colspan="2"><hr></th>
      </tr>      
    </table>
	</td>
  </tr>
</table>
</body> 
</html>  
